﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Transformer.iHunter.UI;

namespace Transformer.iHunter.Plugins
{
    public partial class ThuLearningEditor : Transformer.iHunter.UI.HtmlMessageEditorBase
    {
        public ThuLearningEditor()
        {
            InitializeComponent();
        }

        protected override string[] GetFields()
        {
            return new string[] { "Title" };
        }

        public override bool MessageValid
        {
            get
            {
                FieldTextBox txtBox = txtBoxes["Title"];
                if (null == txtBox.Text || txtBox.Text.Trim().Length == 0)
                {
                    ShowMessageInvalidReason("Title", "Title can not be empty");
                    return false;
                }
                
                if (base.attachmentNum > 1)
                {
                    MessageBox.Show("Message to be sent to THU online learning only allow at most one attachment");
                    return false;
                }

                return true;
            }
        }

        protected override string[] ReadonlyFieldsOnReply()
        {
            return new string[] { "Title" };
        }

    }
}
